#include <bits/stdc++.h>
using namespace std;

int main()
{
	map<int, int> m;

	int n;
	int temp;
	cin >> n;
	
	while(n--)
	{
		cin >> temp;
		++m[temp];
	}
	
	cout << max_element(m.begin(), m.end(), 
					[](const pair<int, int> &p1, const pair<int, int> &p2){
							return p1.second < p2.second;
					})->first;

	return 0;
} 
